﻿@model AugustaDevelopersGuild.Models.Meeting
<script type="text/javascript">

    function AnimateRSVPMessage() {
        $("#rsvpmsg").animate({ fontSize: "1.5em" }, 400);
    }

</script>
<div id="rsvpmsg">
    @if (Request.IsAuthenticated)
    {
        if (Model.IsUserRegistered(Context.User.Identity.Name))
        {
        <p>
            You are registered for this event!</p>
    
        @Ajax.ActionLink("Cancel your RSVP",
                             "Cancel", "Rsvp",
                             new { id = Model.MeetingID },
                             new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "rsvpmsg", OnSuccess = "AnimateRSVPMessage" })    
	
        }
        else
        { 
	
        @Ajax.ActionLink("RSVP for this event",
                                      "Register", "Rsvp",
                                      new { id = Model.MeetingID },
                             new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "rsvpmsg", OnSuccess = "AnimateRSVPMessage" })
        }
    }
    else
    {
        <strong>You must be @Html.ActionLink("logged on", "LogOn", "Account") to register for this event</strong>
    }
</div>
